<template>
  <div class="showMatch">
    <el-dialog :title="'手动匹配  记录ID:' + id + '      记录金额：' + amount" :visible.sync="showDialog" @close="$emit('update:showMatchInfo', false)"
               :showMatchInfo="showMatchInfo">
      <el-form class="small-space" ref="adjustTypeFrom" label-position="right" label-width="35%">
        <el-row>
          <el-col :sm="12" :offset="6">
            <el-form-item label="订单号：">
              <el-input v-model="OperateInfo.order_id" placeholder="..."></el-input>
            </el-form-item>
            <el-form-item label="处理意见：">
              <el-input v-model="OperateInfo.msg"  placeholder="..."></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="$emit('update:showMatchInfo', false)">取 消</el-button>
        <el-button type="primary" :loading="loading" @click="make_success">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
  import { matchRecord } from '@/api/merchant'
  export default {
    name: 'UserSet',
    data() {
      return {
        showDialog: this.showMatchInfo,
        loading: false,
        OperateInfo: {}
      }
    },
    props: {
      showMatchInfo: {
        type: Boolean,
        default: false
      },
      id: {
        type: Number
      },
      amount: {
        type: Number
      }
    },
    created(){
    },
    methods: {
      make_success(){
        let body = {}
        body.record_id = this.id
        body.msg = this.OperateInfo.msg
        body.order_id = this.OperateInfo.order_id
        matchRecord(body).then(res => {
          if(res.status === 0){
            this.$message.success(`成功!!!`)
            this.$emit('update:showMatchInfo', false)
          }
        })
      }
    },
    watch: {
      showMatchInfo() {
        this.showDialog = this.showMatchInfo
      }
    }
  }
</script>
